home *** CD-ROM | disk | FTP | other *** search
-
- On Wed, 11 Jan 1995 clayton@pms505.pms.ford.com wrote:
-
- [...]
- >
- > Is there a patch/extension (or whatever) which allows the reading of a mouse
- > from the other port? Perhaps a call like USE_MOUSE_PORT(1) to
- > set up the condition, and a call like USE_MOUSE_PORT(0) to set the system
- > back to default.
- >
- I think there might be but I am not too sure..
-
- > I am not asking for both mice to be read simultaneously
- > (although that capability would be very nice for other applications),
- > just the ability to read EITHER mouse 0 or mouse 1.
- >
- > DOES THAT FUNCTIONALITY EXIST in AMOS?
-
- No...
-
- > Or is it a major oversight??
-
- Most of Amos is...
-
- > It would make many programs much nicer. And the AMIGA hardware supports it.
- >
-
- Here is some C code to do it... you can convert to Amos if you like..
-
- #include <intuition/intuition.h>
- #include <clib/exec_protos.h> /* Wait() Message stuuf */
- #include <clib/dos_protos.h>
-
- #include <exec/types.h>
- #include <hardware/custom.h>
- #include <hardware/cia.h>
-
- #include "screen.h" /* needed for M_GetCurrWindow() */
- #include "input.h"
-
- /* This will automatically be linked to the Custom structure: */
- extern struct Custom far custom;
-
- /* This will automatically be linked to the CIA A (8520) chip: */
- extern struct CIA far ciaa;
-
-
-
- UBYTE M_GetMousePort(UBYTE port)
- {
- UBYTE data = 0;
- UWORD joy, pot;
-
- custom.potgo = 0xFF00;
- pot = custom.potinp;
-
- if( port == 1 )
- {
- /* PORT 1 "MOUSE PORT" */
- joy = custom.joy0dat;
- data += !( ciaa.ciapra & 0x0040 ) ? LEFT_BUTTON : 0;
- data += !( pot & 0x0100 ) ? MIDDLE_BUTTON : 0;
- data += !( pot & 0x0400 ) ? RIGHT_BUTTON : 0;
- }
- else
- {
- /* PORT 2 "JOYSTICK PORT" */
- joy = custom.joy1dat;
- data += !( ciaa.ciapra & 0x0080 ) ? LEFT_BUTTON : 0;
- data += !( pot & 0x1000 ) ? MIDDLE_BUTTON : 0;
- data += !( pot & 0x4000 ) ? RIGHT_BUTTON : 0;
- }
- return( data );
- }
-
- /* Here are some Defines To Help Use these Function */
- #define LEFT_BUTTON 1
- #define MIDDLE_BUTTON 2
- #define RIGHT_BUTTON 4
- #define M_LMB2_Pressed() ((M_GetMousePort(PORT2))&LEFT_BUTTON)
- #define M_RMB2_Pressed() ((M_GetMousePort(PORT2))&RIGHT_BUTTON)
- #define M_MMB2_Pressed() ((M_GetMousePort(PORT2))&MIDDLE_BUTTON)
-
-
-
- I hope this helps...
-
-
- mike
-
-
-
- > Thanks.
- >
- > +-----------------------------+
- > | clayton@pms505.pms.ford.com |
- > | // an AMIGA programmer! |
- > | // (the only intelligent |
- > | \X/ choice) -- PEACE -- |
- > +-----------------------------+
- >
- >
- >
-
-